package com.doform.android.xianggucheng.activity.money;

import android.graphics.drawable.ColorDrawable;
import android.widget.TextView;

import com.doform.android.xianggucheng.R;
import com.doform.android.xianggucheng.activity.BaseTitleActivity;
import com.doform.android.xianggucheng.bean.BillBean2;
import com.doform.android.xianggucheng.utils.Constans;

import butterknife.BindView;

/**
 * 作者 Y_MS
 * Created by ${APEN} on 2017-07-22.
 * GitHub：https://github.com/cxydxpx
 */

public class BillDetailActivity extends BaseTitleActivity {

    @BindView(R.id.tv_money)
    TextView tv_money;
    @BindView(R.id.tv_statu)
    TextView tv_statu;
    @BindView(R.id.tv_code)
    TextView tv_code;
    @BindView(R.id.tv_type)
    TextView tv_type;
    @BindView(R.id.tv_transType)
    TextView tv_transType;
    @BindView(R.id.tv_time)
    TextView tv_time;
    private BillBean2 mBean;

    @Override
    protected int layoutResId() {
        return R.layout.activity_bill_detail;
    }

    @Override
    protected void init() {
        super.init();
        BillBean2 bean = (BillBean2) getIntent().getSerializableExtra(Constans.EXTRA__BILL);
        if (null != bean) {
            this.mBean = bean;
        }
    }

    @Override
    protected void showView() {

        titleBar.setTextTitle("订单详情");
        titleBar.setBackgroundColor(new ColorDrawable(getResources().getColor(R.color.blue2)));
        if (mBean != null) {
            tv_money.setText("￥" + mBean.getAmount());//金额

            if ("success".equals(mBean.getStatus())) {
                tv_statu.setText("交易成功");
            }

            switch (mBean.getTransType()) {
                case "11":
                    tv_transType.setText("份额强增");
                    break;
                case "12":
                    tv_transType.setText("正常申购");
                    break;
                case "13":
                    tv_transType.setText("份额强减");
                    break;
                case "14":
                    tv_transType.setText("正常赎回");
                    break;
                case "15":
                    tv_transType.setText("正常收益");
                    break;
            }
            tv_type.setText(mBean.getMemo());//业务类型
            tv_code.setText(mBean.getStmtNumber());//交易流水号
            tv_transType.setText(mBean.getItemName());//交易类型
            tv_time.setText(mBean.getDate());//时间

        }
    }
}
